import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/index.js'

// 引入 FontAwesome
import FontAwesomeIcon from '@/IconFont'

// 引入iconfont
import '@/IconFont/iconfont.js'
import '@/IconFont/icon.css'

import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// 引入 animated 动画
import animated from 'animate.css'

// 引入 API 和组件库
require('./uiComponents')
require('./api')
require('./infiniteScroll')
// 挂载 FontAwesome
Vue.component('font-awesome-icon', FontAwesomeIcon)

Vue.use(animated)
Vue.use(NProgress)

Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
  NProgress.start()
  next()
})

// 跳转后返回顶部
router.afterEach(() => {
  NProgress.done()
  window.scrollTo(0, 0)
})

new Vue({
  router,
  render: h => h(App),
  components: {
    App
  },
  store
}).$mount('#app')
